/**
 *
 */
package de.cbf.cam.dsa.model.definitions;

import java.util.ArrayList;
import java.util.List;

import de.cbf.cam.dice.entities.RollDataModifier;
import de.cbf.cam.dsa.model.test.ListenerLogicTargeted;

/**
 * @author Surfer
 *
 */
public class BattleRollDefinition {
	/**
	 * @uml.property  name="throwData"
	 * @uml.associationEnd
	 */
	private RollDataModifier throwData;
	/**
	 * @uml.property  name="throwDataInitializer"
	 * @uml.associationEnd
	 */
	private InitializerRollData throwDataInitializer;
	/**
	 * @uml.property  name="listeners"
	 * @uml.associationEnd  multiplicity="(0 -1)" elementType="de.cbf.cam.dsa.model.test.ListenerLogicTargeted"
	 */
	private List<ListenerLogicTargeted> listeners = new ArrayList<ListenerLogicTargeted>();
	/**
	 * @uml.property  name="side"
	 */
	private int side;


	@Override
	public String toString() {
		if(throwData != null){
			return throwData.getName();
		}
		return super.toString();
	}
	/**
	 * @return
	 * @uml.property  name="throwData"
	 */
	public RollDataModifier getThrowData() {
		return throwData;
	}
	/**
	 * @param throwData
	 * @uml.property  name="throwData"
	 */
	public void setThrowData(RollDataModifier throwData) {
		this.throwData = throwData;
	}
	/**
	 * @return
	 * @uml.property  name="throwDataInitializer"
	 */
	public InitializerRollData getThrowDataInitializer() {
		return throwDataInitializer;
	}
	/**
	 * @param throwDataInitializer
	 * @uml.property  name="throwDataInitializer"
	 */
	public void setThrowDataInitializer(InitializerRollData throwDataInitializer) {
		this.throwDataInitializer = throwDataInitializer;
	}
	public boolean addListener(ListenerLogicTargeted listener) {
		return listeners.add(listener);
	}
	public boolean removeListener(ListenerLogicTargeted listener) {
		return listeners.remove(listener);
	}
	public List<ListenerLogicTargeted> getListeners() {
		return listeners;
	}
	public void setListeners(List<ListenerLogicTargeted> listeners) {
		this.listeners = listeners;
	}
	/**
	 * @return
	 * @uml.property  name="side"
	 */
	public int getSide() {
		return side;
	}
	/**
	 * @param side
	 * @uml.property  name="side"
	 */
	public void setSide(int side) {
		this.side = side;
	}
	public String getName() {
		if(throwData != null){
			return throwData.getName();
		}
		return "";
	}

}
